﻿
namespace LS.Nc6.Application.Cms
{
    
    public class Mapper : IRegister
    {
       
        public void Register(TypeAdapterConfig config)
        {
            config.ForType<SysDictionaryEntity, DictionaryOutput>()
                .Map(dest => dest.Description, src => src.Remark);

            config.ForType<CmsContentEntity, ContentOutput>()
                 .Map(dest => dest.GroupNames, src => src.GroupNameCollection)
                 .Map(dest =>dest.ImageUrls,src=>src.ImageUrlIds.GetStringArrayNoNull())
                 .Map(dest => dest.VideoUrls, src => src.VideoUrlIds.GetStringArrayNoNull())
                 .Map(dest => dest.FileUrls, src => src.FileUrlIds.GetStringArrayNoNull())
                 .Map(dest => dest.ExtendValues,src => JsonSerializer.Deserialize<object>(src.ExtendValues,new JsonSerializerOptions { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }));
        }
    }
}
